/**
 *
 */
package com.geezdata.cps.ttk.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.geezdata.cps.base.annotation.LoggerOut;
import com.geezdata.cps.base.response.BaseResponse;
import com.geezdata.cps.cqrs.command.Command;
import com.geezdata.cps.cqrs.command.bus.CommandBus;
import com.geezdata.cps.ttk.common.request.CreateOrUpdatePromotionUrlRequest;
import com.geezdata.cps.ttk.common.response.CreateOrUpdatePromotionUrlResult;


/**
 * @author tfwan
 * @date 创建时间：2018年6月12日 下午3:07:02
 *
 */
@RestController
@RequestMapping(value="/promotionUrl")
public class PromotionUrlController {
	@Autowired
    private CommandBus commandBus;
	@Autowired
	private Command<CreateOrUpdatePromotionUrlRequest, CreateOrUpdatePromotionUrlResult> createOrUpdatePromotionUrlCommand;
	
	@LoggerOut
    @RequestMapping(value = "/createOrUpdatePromotionUrl", method = RequestMethod.POST)
    public BaseResponse<CreateOrUpdatePromotionUrlResult> createOrUpdatePromotionUrl(@RequestBody CreateOrUpdatePromotionUrlRequest request) {
		return commandBus.dispatch(createOrUpdatePromotionUrlCommand, request);
    }
}
